﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Easy.BLL;
using Easy.Operation;

namespace Easy.Web.Service.Privilege
{
    /// <summary>
    /// 根据角色ID获取SiteMap
    /// </summary>
    public class SiteMap : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain"; 
            
            string RoleId = context.Request["RoleId"];

            if (string.IsNullOrEmpty(RoleId))
            {
                RoleId = Guid.Empty.ToString();
            }

            string json = new SiteMapManager().GetSiteMapByRoleId(new Guid(RoleId));
            
            context.Response.Write(json);
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}